package com.minyifang.wcspf.work;

import android.content.Context;
import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;

import com.umeng.commonsdk.UMConfigure;
import com.umeng.message.IUmengRegisterCallback;
import com.umeng.message.PushAgent;
import com.umeng.socialize.PlatformConfig;

/**
 * Created by xuyougen on 2018/4/11.
 */

public class MyApplication extends MultiDexApplication {
    private static Context mApplicationContext;

    @Override
    public void onCreate() {
        super.onCreate();
        mApplicationContext = this;
        UMConfigure.init(this, "5bf63a73f1f55607e300000e", "wcspf",
                UMConfigure.DEVICE_TYPE_PHONE, "a0e269677a3c0618a2e924222f21602b");
        PlatformConfig.setWeixin("wx976d46f7fcb104aa", "ac881cb739344a6f22d8b21edca7a948");
        UMConfigure.setLogEnabled(true);

        PushAgent mPushAgent = PushAgent.getInstance(this);
        //注册推送服务，每次调用register方法都会回调该接口
        mPushAgent.register(new IUmengRegisterCallback() {
            @Override
            public void onSuccess(String deviceToken) {
                //注册成功会返回device token
            }

            @Override
            public void onFailure(String s, String s1) {
            }
        });
    }

    public static Context getContext() {
        return mApplicationContext;
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }
}
